//package samples.chapter10;
//
//import at.pollux.thymeleaf.shiro.dialect.ShiroDialect;
//import org.apache.shiro.realm.Realm;
//import org.apache.shiro.realm.text.TextConfigurationRealm;
//import org.apache.shiro.spring.web.config.DefaultShiroFilterChainDefinition;
//import org.apache.shiro.spring.web.config.ShiroFilterChainDefinition;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//@Configuration
//public class Chapter10ShiroConfig {
//    @Bean
//    public Realm realm() {
//        TextConfigurationRealm realm = new TextConfigurationRealm();
//        realm.setUserDefinitions("sang=123456,user\n admin=123456,admin");
//        realm.setRoleDefinitions("admin=read,write\n user=read");
//        return realm;
//    }
//
//    @Bean
//    public ShiroFilterChainDefinition shiroFilterChainDefinition() {
//        DefaultShiroFilterChainDefinition chainDefinition = new DefaultShiroFilterChainDefinition();
//        chainDefinition.addPathDefinition("/chapter10/shiro/login", "anon");
//        chainDefinition.addPathDefinition("/chapter10/shiro/doLogin", "anon");
//        chainDefinition.addPathDefinition("/chapter10/shiro/logout", "anon");
//        chainDefinition.addPathDefinition("/chapter10/shiro/**", "authc");
//        return chainDefinition;
//    }
//
//    @Bean
//    public ShiroDialect shiroDialect() {
//        return new ShiroDialect();
//    }
//}
